<div>
    <fieldset>
        <legend>Параметры атрибута</legend>
        <input type="hidden" value="<?php echo $this->data['field_id']; ?>" id="field_id"/>

        <table>
            <tr><td></td><td class="ErrorMessage" data-field="log"></td></tr>

            <tr>
                <td><label for="name">Название атрибута</label></td>
                <td><input class="Text" type="text" id="name" value="<?php echo @$this->data['name']; ?>"/></td>
            </tr>
            <tr><td></td><td class="ErrorMessage" data-field="name"></td></tr>

            <tr>
                <td><label for="type">Тип атрибута</label></td>
                <td><input id="type" class="Text" type="text" readonly="readonly"
                           value="<?php echo $this->data['type_name']; ?>"/></td>
            </tr>
        </table>

    </fieldset>

    <div class="ControlPanel">
        <button id="AltField">Сохранить</button>
        <button id="DelField">Удалить</button>
        <button id="CancelAddField">Отмена</button>
    </div>

    <script type="text/javascript">
        jsun.run(function() {
        //////////////////////////////////////////////////////

        jsun("#AltField").jsun.event({ onclick: AltField });
        jsun("#DelField").jsun.event({ onclick: DelField });
        jsun("#CancelAddField").jsun.event({ onclick: Cancel });

        function Cancel() {
            return jsun.dialog.active.close();
        }

        function DelField() {
            var param = "u=Edition/DelField&field_id="
                + jsun("#field_id").value;

            jsun.json.load(function(p) {
                if (p.STAT == 'OK') {
                    window.location.reload();
                } else {
                    jsun.show_err(p);
                }
            }, param);

            return true;
        }

        function AltField() {
            var param = "u=Edition/AltField" + jsun.page.get_data();

            jsun.json.load(function(p) {
                if (p.STAT == 'OK') {
                    window.location.reload();
                } else {
                    jsun.show_err(p);
                }
            }, param);
        }


        ///////////////////////////////////////////////////////
        });
    </script>
</div>